package com.ssps.back.platform.controller;

import com.ssps.back.platform.service.RoleService;
import com.ssps.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author li
 * @time 2020/07/22 19:00:56
 */

@Controller
@RequestMapping("role")
public class RoleController {

    @Autowired
    RoleService roleService;

    @RequestMapping("findAll")
    @ResponseBody
    public Map<String,Object> roleFindAll(){

        Map<String, Object> map=new HashMap<>();
        try{
            List<Role>roleList= roleService.findAll();
            map.put("roleList",roleList);
            map.put("result",true);
        }catch (Exception e){
            e.printStackTrace();
            map.put("result",false);
        }
        return map;
    }
}
